home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacGames Sampler
/
PHT MacGames Bundle.iso
/
MacSource Folder
/
Samples from the CD
/
C and C++
/
POSIX
/
ThinkCPosix
/
rmdir.c
< prev
next >
Wrap
Text File
|
1992-09-11
|
566b
|
31 lines
/* $Id: $ */
#include "ThinkCPosix.h"
/* Rmdir for the Macintosh.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
Pathnames must be Macintosh paths, with colons as separators. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ThinkCPosix.h"
int
rmdir(path)
char *path;
{
IOParam pb;
char name[FILENAME_MAX];
strncpy(name, path, sizeof(name) - 1);
c2pstr(name);
pb.ioNamePtr= (unsigned char*)name;
pb.ioVRefNum= 0;
if (PBDelete((ParmBlkPtr)&pb, FALSE) != noErr) {
errno= EACCES;
return -1;
}
return 0;
}